Conversation
This comment was marked as spam.
This comment was marked as spam.
| 3. 对好的实践也要给予肯定 | ||
| 4. 保持客观、专业 | ||
| claude_args: | | ||
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" --json-schema '{"type":"object","properties":{"conclusion":{"type":"string","enum":["APPROVE","REQUEST_CHANGES","COMMENT"]},"summary":{"type":"string","maxLength":50},"critical_count":{"type":"integer"},"important_count":{"type":"integer"},"suggestion_count":{"type":"integer"}},"required":["conclusion","summary","critical_count","important_count","suggestion_count"]}' |
There was a problem hiding this comment.
代码可读性问题:
这一行的 claude_args 参数格式非常难以阅读和维护:
- JSON schema 直接写在一行中,无法辨识结构
- 工具列表混在一起,不易理解
建议改进:
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
--json-schema '{
"type": "object",
"properties": {
"conclusion": {"type": "string", "enum": ["APPROVE", "REQUEST_CHANGES", "COMMENT"]},
"summary": {"type": "string", "maxLength": 50},
"critical_count": {"type": "integer"},
"important_count": {"type": "integer"},
"suggestion_count": {"type": "integer"}
},
"required": ["conclusion", "summary", "critical_count", "important_count", "suggestion_count"]
}'或者考虑使用 YAML 的多行格式提高可读性。
| 3. 使用简体中文 | ||
| claude_args: | | ||
| --allowedTools "Bash(gh *)" "Bash(git *)" "Read" "Glob" "Grep" | ||
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" --json-schema '{"type":"object","properties":{"conclusion":{"type":"string","enum":["PASS","WARN","FAIL"]},"summary":{"type":"string","maxLength":50}},"required":["conclusion","summary"]}' |
There was a problem hiding this comment.
相同的可读性问题:
与 pr-review.yml:76 相同的问题,建议采用相同的格式优化方案。
| 3. 使用简体中文 | ||
| claude_args: | | ||
| --allowedTools "Bash(gh *)" "Bash(git *)" "Read" "Glob" "Grep" | ||
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" --json-schema '{"type":"object","properties":{"conclusion":{"type":"string","enum":["PASS","WARN","FAIL"]},"summary":{"type":"string","maxLength":50}},"required":["conclusion","summary"]}' |
There was a problem hiding this comment.
配置不一致问题:
Commit Review 的 allowedTools 配置与 PR Review 完全相同,但 Commit Review 不需要创建 PR 评论。
当前工具包括:
mcp__github_inline_comment__create_inline_comment- 用于 PR inline 评论Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)- 都是 PR 相关命令
建议: Commit Review 应该使用不同的工具集,移除 PR 相关工具,可能需要添加 Bash(git *) 等 git 命令支持。
| 3. 使用简体中文 | ||
| claude_args: | | ||
| --allowedTools "Bash(gh *)" "Bash(git *)" "Read" "Glob" "Grep" | ||
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" --json-schema '{"type":"object","properties":{"conclusion":{"type":"string","enum":["PASS","WARN","FAIL"]},"summary":{"type":"string","maxLength":50}},"required":["conclusion","summary"]}' |
There was a problem hiding this comment.
❌ 工具权限配置错误
Commit Review 不涉及 PR 操作,但配置中包含了 PR 相关的工具:
mcp__github_inline_comment__create_inline_comment- 用于 PR inline commentBash(gh pr comment:*)- PR 评论命令Bash(gh pr diff:*)- PR diff 命令Bash(gh pr view:*)- PR 查看命令
建议修改为:
--allowedTools "Bash(git show:*),Bash(git diff:*),Bash(git log:*),Read,Glob,Grep"| id: review | ||
| uses: anthropics/claude-code-action@v1 | ||
| env: | ||
| ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} |
There was a problem hiding this comment.
需要确认 claude-code-action@v1 是否支持通过 env.ANTHROPIC_BASE_URL 传递。
如果不确定,建议保留原有方式:
with:
anthropic_base_url: ${{ secrets.ANTHROPIC_BASE_URL }}
.github/workflows/pr-review.yml
Outdated
| 你是一个专业的代码审查助手。请对当前 PR 进行全面审查. | ||
|
|
||
| 总是使用 `gh` 命令在github上评论PR, 尽可能的使用一条评论, 不断的更新. | ||
| 使用 `mcp__github_inline_comment__create_inline_comment` to highlight specific code issues. |
There was a problem hiding this comment.
建议统一使用中文:
使用 `mcp__github_inline_comment__create_inline_comment` 工具在具体代码行添加问题标注。
| id: review | ||
| uses: anthropics/claude-code-action@v1 | ||
| env: | ||
| ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} |
There was a problem hiding this comment.
与 PR review workflow 相同的问题,需要确认 claude-code-action@v1 是否支持通过 env.ANTHROPIC_BASE_URL 传递。
| 3. 使用简体中文 | ||
| claude_args: | | ||
| --allowedTools "Bash(gh *)" "Bash(git *)" "Read" "Glob" "Grep" | ||
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" --json-schema '{"type":"object","properties":{"conclusion":{"type":"string","enum":["PASS","WARN","FAIL"]},"summary":{"type":"string","maxLength":50}},"required":["conclusion","summary"]}' |
There was a problem hiding this comment.
🟠 重要问题:allowedTools 配置不匹配实际需求
Commit Review 工作流使用了 mcp__github_inline_comment__create_inline_comment 工具,但这个工具主要用于 PR 的代码评论,不适用于 commit 审查场景。
建议修改为:
--allowedTools "Bash(git *)"Commit Review 只需要 Git 操作工具即可完成审查任务。
| env: | ||
| ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} | ||
| with: | ||
| github_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} |
There was a problem hiding this comment.
🟠 重要问题:github_token 配置缺少回退机制
如果 CUSTOM_GITHUB_TOKEN secret 未配置,workflow 将会失败。
建议添加回退机制:
github_token: ${{ secrets.CUSTOM_GITHUB_TOKEN || github.token }}这样在没有自定义 token 时会自动使用默认的 github.token。
| id: review | ||
| uses: anthropics/claude-code-action@v1 | ||
| env: | ||
| ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} |
There was a problem hiding this comment.
🟠 重要问题:环境变量配置方式需要验证
ANTHROPIC_BASE_URL 使用了 env 方式设置,需要确认 claude-code-action v1 是否支持通过环境变量读取此配置。
在之前的版本中使用的是 anthropic_base_url 参数。建议查看官方文档确认正确的配置方式。
|
|
||
| ALWAYS Answer in 简体中文. | ||
| claude_args: | | ||
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" --json-schema '{"type":"object","properties":{"conclusion":{"type":"string","enum":["APPROVE","REQUEST_CHANGES","COMMENT"]},"summary":{"type":"string","maxLength":50},"critical_count":{"type":"integer"},"important_count":{"type":"integer"},"suggestion_count":{"type":"integer"}},"required":["conclusion","summary","critical_count","important_count","suggestion_count"]}' |
There was a problem hiding this comment.
🟢 改进建议:JSON Schema 格式可读性差
单行的 JSON Schema 难以维护和阅读。建议使用更清晰的格式:
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
--json-schema '{
"type": "object",
"properties": {
"conclusion": {"type": "string", "enum": ["APPROVE", "REQUEST_CHANGES", "COMMENT"]},
"summary": {"type": "string", "maxLength": 50},
"critical_count": {"type": "integer"},
"important_count": {"type": "integer"},
"suggestion_count": {"type": "integer"}
},
"required": ["conclusion", "summary", "critical_count", "important_count", "suggestion_count"]
}'或者将 schema 定义在单独的文件中引用。
| # 自定义审查要求 | ||
| ``` | ||
|
|
||
| ### 修改结构化输出 |
There was a problem hiding this comment.
🟢 改进建议:文档需要更详细的说明
"修改结构化输出" 一节建议补充以下内容:
-
字段含义说明:
conclusion: 审查结论(APPROVE/REQUEST_CHANGES/COMMENT)summary: 一句话总结(最多50字)critical_count: 严重问题数量important_count: 重要问题数量suggestion_count: 建议数量
-
如何添加新字段:如添加
reviewer字段的步骤 -
与飞书通知的关联:说明这些字段如何被飞书通知步骤使用
🔍 PR 代码审查报告📋 概要
🎯 审查结论💬 COMMENT - 这是一次重要的架构改进,将审查配置从命令文件迁移到 workflow prompt 中,整体实现合理,但存在一些需要优化的问题。 🔴 严重问题 (Critical)无 🟠 重要问题 (Important)
🟢 改进建议 (Suggestions)
💡 总体评价优点:
需要改进的方面:
总结: |
No description provided.